package com.example.academic_affairs_system.controller;

import com.example.academic_affairs_system.common.R;
import com.example.academic_affairs_system.model.dto.classCourses.ClassCoursesDTO;
import com.example.academic_affairs_system.model.dto.classCourses.ClassCoursesPageDTO;
import com.example.academic_affairs_system.service.IAasCoursesService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * 课程表 前端控制器
 *
 * @author hjx
 * @since 2023-01-31
 */
@RestController
@RequestMapping("/sys/courses")
public class AasCoursesController {
  @Resource IAasCoursesService iAasCoursesService;

  @PostMapping("/create")
  public R create(@RequestBody ClassCoursesDTO dto) {
    return R.ok(iAasCoursesService.createCourses(dto));
  }

  @PostMapping("/edit")
  public R list(@RequestBody ClassCoursesDTO dto) {
    return R.ok(iAasCoursesService.edit(dto));
  }

  @GetMapping("/list")
  public R list(ClassCoursesPageDTO dto) {
    return R.ok(iAasCoursesService.getCoursesVOPage(dto));
  }

  @GetMapping("/director")
  public R director() {
    return R.ok(iAasCoursesService.getDirectorCourses());
  }
}
